<template>
	<div style="display: flex;flex-direction: column;" class="otherPage centreOfExcellence manpowerAnnouncement">
		<Header :selected="8"></Header>
		<div class="bannerArea">
			<div class="banner" :style="bg_img? 'background:url('+bg_img+') no-repeat;background-size:cover;':''">
			</div>
		</div>
		<Navigation :items="breadcrumbItems" :menus="menus" :checked="4" :bgColor="bgColor"></Navigation>
		<div class="content" style="min-height: 600px;">
			<div class="content_bg" style="min-height: 600px;">
				<el-row>
					<el-col :span="24" class="Announcement_Title">
						<div class="manpowerAnnouncement_title" style="">{{$t('manpowerAnnouncement')}} </div>
						<div class="manpowerAnnouncement_title_en" style="">
							/BECRUITMENT ANNOUNCEMENT</div>
					</el-col>
					<el-col :span="24" class="newArea">
						<div class="news-list">
							<el-row :gutter="0" v-for="(item, index) in data" :key="index" class="news-item"
								:class="{ 'hover': hoverIndex === index }" @mouseover="hoverIndex = index"
								@mouseleave="hoverIndex = -1">
								<el-col :xs="5" :sm="3" :md="3" :lg="3">
									<div class="date">
										<div class="day">{{ formatDate(item.publishTime, 'dd') }}</div>
										<!-- <div class="dateText">DATE</div> -->
										<div class="month-year">{{item.publishTime?item.publishTime.substring(0,7):''}}
										</div>
									</div>

								</el-col>
								<el-col :xs="15" :sm="18" :md="18" :lg="18" class="newcontent">
									<div class="newcontentcontainer">
										<div class="title" @click="gotoInfo(item.id)">{{ item.titles }}</div>
										<!-- 	<div class="number-of-views">浏览次数 {{ item.num }}</div> -->
										<p v-html="item.content" class="description"> </p>

									</div>
								</el-col>
								<el-col :xs="4" :sm="3" :md="3" :lg="3" class="newcontentMoreArea">
									<div class="moreInfoBtn" @click="gotoInfo(item.id)">{{$t("more")}} <i class="el-icon-d-arrow-right"></i></div>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>

				<el-row :gutter="24" type="flex" class="paginationArea">
					<el-pagination   background :current-page.sync="currentPage" :page-size="pageSize"
						layout=" prev, pager, next,jumper" :total="total" :prev-text="$t('previousPage')"
						:next-text="$t('nextPage')" @current-change="handleCurrentChange" />
				</el-row>

			</div>
		</div>
		<Footer></Footer>
	</div>
</template>

<script>
	import Header from '../../components/common/header/Header.vue'
	import Navigation from '../../components/common/navigation/Navigation.vue'
	import Footer from '../../components/common/footer/Footer.vue'
	import Pagination from '../../../src/components/common/Pagination.vue'
	import {
		fmtDate
	} from '../../utils/tools'
	import {
		centreOfExcellenceMenu
	} from '../../utils/menu.js'
	// 导入您需要的模块
	import Swiper from "swiper";
	export default {
		components: {
			Header,
			Navigation,
			Footer,
			Pagination,
			fmtDate
		},
		data() {
			return {
				bg_img: '', //头部banner，默认值已绑定，有背景自动切换
				bgColor: "white", //white/red
				pageSize: 10,
				total: 0,
				currentPage: 1,
				menus: centreOfExcellenceMenu,
				breadcrumbItems: [{
						label: this.$t('home'),
						to: '/'
					},
					{
						label: this.$t('centreOfExcellence'),
						to: '/centreOfExcellence'
					},
					{
						label: this.$t('manpowerAnnouncement'),
						to: '/manpowerAnnouncement'
					}
				],
				hoverIndex: -1,
				companyProfile: {
					content: ""
				},
				data: []

			};
		},
		computed: {},
		created() {},
		mounted() {
			this.bindBg()
			this.bindRecruitNoticePage();
		},
		methods: {
			/**
			 * (1)	获取人力公告内容
			 */
			bindRecruitNoticePage() {
				let params = {
					"pageNum": this.currentPage,
					"pageSize": this.pageSize
				};
				let that = this;
				that.$request.recruitNoticePage(params).then(res => {
					this.data = res.data.records;
					this.total = res.data.total;
					// this.currentPage = res.data.pageNum

				}).catch((error) => {
					console.log(error);
				});

			},
			/**
			 * 获取人力公告顶部背景
			 */
			bindBg() {
				let params = {};
				let that = this;
				that.$request.rlGgBgImage(params).then(res => {
					this.bg_img = res.data.fileUrl
				}).catch((error) => {
					console.log(error);
				});

			},

			gotoInfo(id) {
				this.$router.push({
					name: this.$t('manpowerAnnouncementInfo'),
					query: {
						id: id
					}
				});
			},
			formatDate(date, format) {
				// 自定义日期格式化方法
				// 可以使用moment.js或其他日期处理库来进行格式化
				console.log('dateFormatFun(date)', date)
				return fmtDate(new Date(date), format);
			},
			///////获取点击页码，请求接口
			handleCurrentChange(currentPage) {
				console.log(currentPage, 'currentPage');
				this.currentPage = currentPage;
				this.bindRecruitNoticePage();
			},
		}
	}
</script>

<style scoped>
	@import url("../../components/common/css/centreOfExcellence/centreOfExcellence.css");

	.Announcement_Title {
		height: 40px;
		color: #cecece;
		display: flex;
		margin-bottom: 20px;
	}

	.manpowerAnnouncement .newArea {
		height: auto;
	}

	.manpowerAnnouncement .paginationArea {
		height: 70px;
		line-height: 70px;
		justify-content: center;
		padding-top: 20px;
	}

	.manpowerAnnouncement .moreInfoBtn {
		width: 100%;
		height: 14vh;
		line-height: 12vh;
		align-items: center;
		text-align: center;
		color: #0484D7;
		font-size: 16px;
		padding: 0px;
	}

	.manpowerAnnouncement .moreInfoBtn:hover {
		background-color: ##0396f0;
		color: #0396f0;
	}

	.manpowerAnnouncement .news-list .news-item {
		height: 16vh;
		/* 	margin-bottom: 1vh ; */
		border-bottom: 1px solid #E8E6E5;
	}

	.manpowerAnnouncement .news-list .date {
		border-bottom: 2px solid #E8E6E5;
		height: 12vh;
		background: #EDEDED;
		margin-top: 2vh;
		width: 80%;
	}

	.manpowerAnnouncement .news-list .title {
		font-size: 1.5rem;
		font-weight: 530;
		color: #333333;
		height: 6vh;
		line-height: 6vh;
		padding: 0px;
		align-items: center;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.manpowerAnnouncement .news-list .number-of-views {
		font-size: 14px;
		font-weight: 400;
		color: #999999;
		height: 5vh;
		line-height: 5vh;
		align-items: center;
	}

	.manpowerAnnouncement .news-list .description {
		font-size: 14px;
		font-weight: 400;
		color: #666666;
		height: 6vh;
		line-height: 3vh;
		padding: 0px;
		align-items: center;
		overflow: hidden;
	}

	.manpowerAnnouncement .news-list .day {
		text-align: center;
		font-size: 2em;
		padding-top: 2vh;
		height: 7vh;
		font-weight: 400;
		color: #0484D7;
		/* padding-left: 15px; */
	}

	.manpowerAnnouncement .dateText {
		height: 4vh;
		line-height: 4vh;
		align-items: center;
		text-align: left;
		color: #777777;
		font-size: 1.2em;
		/* padding-left: 15px; */
		opacity: 0.8;
	}

	.manpowerAnnouncement .news-list .month-year {
		text-align: center;
		font-size: 1.2em;
		/* padding-left: 15px; */
		opacity: 0.8;
		color: #777777;
	}

	.manpowerAnnouncement .btn-next span {
		min-width: 50px !important;
	}

	.el-pagination span:not([class*=suffix]) {
		display: inline-block;
		font-size: 13px;
		min-width: 50px !important;
		height: 28px;
		line-height: 28px;
		vertical-align: top;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	.news-item {
		margin-bottom: 20px;
		cursor: pointer;
		overflow: hidden;
		transition: transform 0.3s ease;
		/* 添加过渡效果 */
	}

	.manpowerAnnouncement .news-item:hover {
		transform: scale(0.98)
	}

	.manpowerAnnouncement .news-item:hover .title {
		color: #0484D7;
	}

	.manpowerAnnouncement .news-item:hover .date {
		background-color: #0484D7;
	}

	.manpowerAnnouncement .news-item:hover .day,
	.manpowerAnnouncement .news-item:hover .month-year,
	.manpowerAnnouncement .news-item:hover .dateText {
		color: #FFF;
		opacity: 1;
	}

	.manpowerAnnouncement .news-list .newcontent {
		margin-top: 1vh;
	}

	.manpowerAnnouncement .news-list .newcontent .newcontentcontainer {
		background-color: #FFF;
	}

	.newcontentMoreArea {
		overflow: hidden;
		height: 19vh;
		/* border-left: 1px solid #dedede; */
		margin-top: 2vh;
	}

	.manpowerAnnouncement_title {
		font-size: 1.5rem;
		height: 40px;
		line-height: 40px;
		font-weight: 600;
	}

	.manpowerAnnouncement_title_en {
		font-size: 1.1rem;
		height: 40px;
		line-height: 50px;
		padding-left: 10px;
		font-style: italic;
		font-weight: 600;
	}
	::v-deep .el-pagination span:not([class*=suffix]) {
		display: inline-block;
		font-size: 13px;
		min-width: 50px;
		height: 28px;
		line-height: 28px;
		vertical-align: top;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}
	@media (max-width:768px) {
		.manpowerAnnouncement_title {
			font-size: 1.2rem;
		}

		.manpowerAnnouncement_title_en {
			font-size: 0.8rem;
			line-height: 45px;
		}

		.manpowerAnnouncement .news-list .newcontent {
			padding: 0px 5px;
			margin-top: 1vh;
		}

		.manpowerAnnouncement .news-list .title {
			font-size: 1rem;
			padding: 0px;
		}

		.manpowerAnnouncement .news-list .description {
			font-size: 0.8rem;
		}

		.manpowerAnnouncement .moreInfoBtn {
			font-size: 12px;
		}
	}
</style>